
/**
  ******************************************************************************
  * Copyright 2021 The Microbee Authors. All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  * http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * 
  * @file       mb_sensor_config.h
  * @author     baiyang
  * @date       2022-5-15
  ******************************************************************************
  */

#pragma once

#ifdef __cplusplus
extern "C"{
#endif

/*----------------------------------include-----------------------------------*/

/*-----------------------------------macro------------------------------------*/
#ifndef MHZ
#define MHZ (1000U*1000U)
#endif

#ifndef KHZ
#define KHZ (1000U)
#endif

#define HAL_I2C_INTERNAL_MASK (1 << 0)

#define SPI1_D1_NAME "spi1_d1"
#define SPI1_D2_NAME "spi1_d2"
#define SPI1_D3_NAME " "
#define SPI1_D4_NAME " "
#define SPI1_D5_NAME " "

#define SPI2_D1_NAME " "
#define SPI2_D2_NAME " "
#define SPI2_D3_NAME " "
#define SPI2_D4_NAME " "

#define SPI3_D1_NAME " "
#define SPI3_D2_NAME " "
#define SPI3_D3_NAME "spi3_d3"
#define SPI3_D4_NAME " "

#define SPI4_D1_NAME " "
#define SPI4_D2_NAME " "
#define SPI4_D3_NAME " "
#define SPI4_D4_NAME " "

#define I2C1_NAME    "i2c1"
#define I2C2_NAME    "i2c2"

#define SPI1_D1_ADDRESS 1U
#define SPI1_D2_ADDRESS 2U
#define SPI1_D3_ADDRESS 3U
#define SPI1_D4_ADDRESS 4U
#define SPI1_D5_ADDRESS 5U


#define SPI2_D1_ADDRESS 1U
#define SPI2_D2_ADDRESS 2U
#define SPI2_D3_ADDRESS 3U
#define SPI2_D4_ADDRESS 4U

#define SPI3_D1_ADDRESS 1U
#define SPI3_D2_ADDRESS 2U
#define SPI3_D3_ADDRESS 3U
#define SPI3_D4_ADDRESS 4U

#define SPI4_D1_ADDRESS 1U
#define SPI4_D2_ADDRESS 2U
#define SPI4_D3_ADDRESS 3U
#define SPI4_D4_ADDRESS 4U

// spi1的ID是0
#define SPI1_D1_SPEED_LOW (2*MHZ)
#define SPI1_D1_SPEED_HIGH (12*MHZ)

#define SPI1_D2_SPEED_LOW (2*MHZ)
#define SPI1_D2_SPEED_HIGH (8*MHZ)

#define SPI1_D3_SPEED_LOW (3*MHZ)
#define SPI1_D3_SPEED_HIGH (3*MHZ)

#define SPI1_D4_SPEED_LOW (3*MHZ)
#define SPI1_D4_SPEED_HIGH (3*MHZ)

#define SPI1_D5_SPEED_LOW (3*MHZ)
#define SPI1_D5_SPEED_HIGH (3*MHZ)

// spi2的ID是1
#define SPI2_D1_SPEED_LOW (3*MHZ)
#define SPI2_D1_SPEED_HIGH (3*MHZ)

#define SPI2_D2_SPEED_LOW (3*MHZ)
#define SPI2_D2_SPEED_HIGH (3*MHZ)

#define SPI2_D3_SPEED_LOW (3*MHZ)
#define SPI2_D3_SPEED_HIGH (3*MHZ)

#define SPI2_D4_SPEED_LOW (3*MHZ)
#define SPI2_D4_SPEED_HIGH (3*MHZ)

// spi3的ID是2
#define SPI3_D1_SPEED_LOW (3*MHZ)
#define SPI3_D1_SPEED_HIGH (3*MHZ)

#define SPI3_D2_SPEED_LOW (3*MHZ)
#define SPI3_D2_SPEED_HIGH (3*MHZ)

#define SPI3_D3_SPEED_LOW (20*MHZ)
#define SPI3_D3_SPEED_HIGH (20*MHZ)

#define SPI3_D4_SPEED_LOW (3*MHZ)
#define SPI3_D4_SPEED_HIGH (3*MHZ)

// spi4的ID是3
#define SPI4_D1_SPEED_LOW (3*MHZ)
#define SPI4_D1_SPEED_HIGH (3*MHZ)

#define SPI4_D2_SPEED_LOW (3*MHZ)
#define SPI4_D2_SPEED_HIGH (3*MHZ)

#define SPI4_D3_SPEED_LOW (3*MHZ)
#define SPI4_D3_SPEED_HIGH (3*MHZ)

#define SPI4_D4_SPEED_LOW (3*MHZ)
#define SPI4_D4_SPEED_HIGH (3*MHZ)
/*----------------------------------typedef-----------------------------------*/

/*----------------------------------variable----------------------------------*/

/*-------------------------------------os-------------------------------------*/

/*----------------------------------function----------------------------------*/

/*------------------------------------test------------------------------------*/

#ifdef __cplusplus
}
#endif



